﻿<?php
function count_open_poll() {
	global $Sondages;
	$i = 0;
	$nb = $Sondages->sondage_size();
	$n = 0;
	while($i < $nb) {
		$sondage = $Sondages->sondage($i);
		if($sondage->open() == 1) 
			$n++;
		$i++;
	}
	return $n;
}
function get_sondage($id) {
	global $Sondages;
	foreach($Sondages->sondage_keys() as $i) {
		$infos = $Sondages->sondage($i);
		if($infos->id() == $id) {
			return $infos;
		}
	}
	return false;
}
?>